package cn.longg.controller;

import cn.longg.entity.Dept;
import cn.longg.entity.Result;
import cn.longg.service.IDeptService;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
@RequestMapping("main/dept")
public class DeptController {
    @Autowired
    private IDeptService deptService;

    @RequestMapping("toDept")
    public ModelAndView toDept(){
        return new ModelAndView("department");
    }

    @RequestMapping("getDeptList")
    public Result getDeptList(){
        List<Dept> depts = deptService.selectAll();
        return new Result(true,"查询成功",depts);
    }

}
